<!DOCTYPE html>
<html lang="cn" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>互联网村镇管理平台</title>
    <link rel="stylesheet" type="text/css" th:href="@{/css/common.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/css/main.css}"/>
    <link th:href="@{/js/libs/zyupload/skins/zyupload-1.0.0.css}" rel="stylesheet" type="text/css" />
    <div th:include="admin/common/common"></div>
    <script type="text/javascript" charset="utf-8" th:src="@{/js/libs/ckeditor/ckeditor.js}"></script>
    <script type="text/javascript" th:src="@{/js/libs/ajaxfileupload.js}"></script>
    <script type="text/javascript" th:src="@{/js/web/projectInfo/projectInfo.js}"></script>
    <script type="text/javascript" th:src="@{/js/libs/zyupload/zyupload.basic-1.0.0.js}"></script>
</head>
<body>
<div class="container clearfix">
    <div class="main-wrap">
        <div class="crumb-wrap">
            <div class="crumb-list">
                <i class="icon-font">&#xe922;</i>
                <a href="javascript:void(0);">项目管理</a>
                <span class="crumb-step">&gt;</span>
                <span class="crumb-name">修改项目</span>
            </div>
        </div>
        <div class="result-wrap">
            <div class="result-content">
                <form id="editProjectInfoForm" onsubmit="return editProjectInfo();">
                    <input type="hidden" id="projectId" name="projectId" th:value="${projectInfo?.projectId}"/>
                    <input type="hidden" id="status" name="status" th:value="${projectInfo?.status}"/>
                    <table class="insert-tab" width="100%">
                        <tbody>
                        <tr>
                            <th style="width:10%;">
                                <i class="require-red">*</i>
                                商家名称：
                            </th>
                            <td>
                            	<select name="goodsId" id="goodsId"  style="width:99%" >
										<option th:each="org:${orgList}" th:value="${org?.orgId}" th:selected="${org?.orgId == projectInfo?.orgId }" th:text="${org.orgName}"></option>
								</select>
                            </td>
                        </tr>
                        <tr>
                            <th style="width:10%;">
                                <i class="require-red">*</i>
                                项目名称：
                            </th>
                            <td>
                                <input class="common-text required" id="name" name="name" style="width:99%" th:value="${projectInfo?.name}"
                                       maxlength="128" type="text"/>
                            </td>
                        </tr>
                         <tr>
                            <th style="width:10%;">
                                <i class="require-red">*</i>
                                项目价格：
                            </th>
                            <td>
                                <input class="common-text required" id="price" name="price" style="width:99%" th:value="${projectInfo?.price}"
                                       maxlength="128" type="text"/>
                            </td>
                        </tr>
                        <tr>
                            <th style="width:10%;">
                                <i class="require-red">*</i>
                                项目介绍：
                            </th>
                            <td>
                                <textarea id="oldContent" style="display: none;" th:text="${projectInfo?.desc}"></textarea>
                                <textarea name="desc" id="desc" rows="10" cols="80">
					            </textarea>
                                <script>
                                    CKEDITOR.replace('desc', {allowedContent:true, filebrowserImageUploadUrl: shiro.baseUrl + "uploadCKEditor",
                                    	toolbar : 'Full',
							            filebrowserFlashUploadUrl :shiro.baseUrl+"uploadVideo"})
                                </script>
                            </td>
                        </tr>
                        <tr>
                            <th style="width: 10%;"><i class="require-red">*</i>
                                项目图片(轮播图)：</th>
                            <td>
                                <input type="hidden" name="picture" id="picture" th:value="${projectInfo?.picture}"/>
                                <div id="zyupload" class="zyupload">
                                    <div class="upload_box">
                                        <div class="upload_main single_main">
                                            <div class="status_bar">
                                                <div id="status_info" class="info">
                                                </div>
                                                <div class="btns">
                                                    <input id="fileImage" type="file" size="30" name="fileselect[]" multiple="" />
                                                    <div class="webuploader_pick">
                                                        选择文件
                                                    </div>
                                                    <div class="upload_btn">
                                                        开始上传
                                                    </div>
                                                </div>
                                            </div>
                                            <div id="preview" class="upload_preview">

                                                <div class="add_upload">
                                                    <a style="height:100px;width:100px;" title="点击添加文件" id="rapidAddImg" class="add_imgBox" href="javascript:void(0)">
                                                        <div class="uploadImg" style="width:85px">
                                                            <img class="upload_image" th:src="@{/js/libs/zyupload/skins/images/add_img.png}" style="width:expression(this.width &gt; 85 ? 85px : this.width)" />
                                                        </div> </a>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="upload_submit">
                                            <button type="button" id="fileSubmit" class="upload_submit_btn">确认上传文件</button>
                                        </div>
                                        <div id="uploadInf" class="upload_inf"></div>
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <th></th>
                            <td>
                                <input class="btn btn-primary btn6 mr10" value="提交" type="submit"/>
                                <input class="btn btn6" onclick="history.go(-1)" value="返回" type="button"/>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </form>
            </div>
        </div>
    </div>
</div>
 <script th:inline="javascript">
    CKEDITOR.instances.desc.setData($('#oldContent').val());
    var pictureUrls = [[${pictureUrls}]];
    
    $(function(){
    	/* var imgUrls = $("#imgUrls").val();
    	var imgUrl=eval("("imgUrls")");  */
    	var img ='';
    	for(var i = 0; i <pictureUrls.length; i++) {
    		img+='<div name=\"oldPictrueDiv\" class=\"upload_append_list\">';
    		img+='<div class=\"file_bar\"><div style=\"padding:5px;\">';
    		img+='<p class=\"file_name\" title=\"轮播图片\">轮播图片</p>';
    		img+='<span class=\"file_del\" data-index=\"0\" title=\"删除\"></span></div></div>';
    		img+='<a style=\"height:100px;width:100px;\" href=\"#\" class=\"imgBox\">';
    		img+='<div class=\"uploadImg\" style=\"width:85px;max-width:85px;max-height:90px;\">';
    		img+='<img class=\"upload_image\" src=\"'+ pictureUrls[i] +'\" style=\"width:expression(this.width &gt; 85 ? 85px : this.width);\" />';
    		img+='</div> </a></div>';
    	}
    	$(".add_upload").before(img);
    });
    // 初始化插件
	 $("#zyupload").zyUpload({
		 isCreate         :false,
        width            :"100%",                  //宽度
        height           :"200px",                 //宽度
        itemWidth        :"100px",                 //文件项的宽度
        itemHeight       :"100px",                 //文件项的高度
        url              :shiro.baseUrl+"/projectInfo/upload",  // 上传文件的路径
        fileType         :["jpg","png","gif","jpeg",],// 上传文件的类型
        fileSize         :51200000,                // 上传文件的大小
        multiple         :true,                    // 是否可以多个文件上传
        dragDrop         :false,                   // 是否可以拖动上传文件
        tailor           :false,                   // 是否可以裁剪图片
        del              :true,                    // 是否可以删除文件
        finishDel        :false,  				  // 是否在上传文件完成后删除预览
        /* 外部获得的回调接口 */
        onSelect: function(selectFiles, allFiles){    // 选择文件的回调方法  selectFile:当前选中的文件  allFiles:还没上传的全部文件
            //console.info("当前选择了以下文件：");
            //console.info(selectFiles);
            //$("div[name='oldPictrueDiv']").remove();
            //$('#picture').val('');

        },
        onDelete: function(file, files){              // 删除一个文件的回调方法 file:当前删除的文件  files:删除之后的文件
            //console.info("当前删除了此文件：");
            //console.info(file.name);
        },
        onSuccess: function(file, response){          // 文件上传成功的回调方法
            if($.trim($('#picture').val()) != '') {
                $('#picture').val( $('#picture').val() + ',' + response);
            } else {
                $('#picture').val(response);
            }
        },
        onFailure: function(file, response){          // 文件上传失败的回调方法
            console.info("此文件上传失败：");
            console.info(file.name);
        },
        onComplete: function(response){           	  // 上传完成的回调方法
            console.log($('#picture').val());
        }
    });
</script>
</body>
</html>